﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Primitives3D;

namespace Comp476Project
{
    public class Node: IEquatable<Node>
    {
        
        public Vector3 position;
        public Matrix world;

        public SpherePrimitive sphere;
        public float costSoFar;
        public float heuristic;
        public float totalCost;
        Matrix projection;
        public List<Node> neighbors;
        public Node parent;
        public float size;
        Color color;
        public Node( Node n) 
        {
            position = n.position;
        }
        public Node(Vector3 pos, Matrix proj, GraphicsDevice g, Color c) 
        {
            costSoFar = float.PositiveInfinity;
            heuristic = float.PositiveInfinity;
            totalCost = costSoFar + heuristic;
            position = pos;
            projection = proj;
            sphere = new SpherePrimitive(g, 0.003f,16);
            neighbors = new List<Node>();
            size = 1f;
            color = c;
          
            world = Matrix.CreateScale(size)*Matrix.CreateTranslation(position);
        }

        public bool Equals(Node other)
        {
            if (this.position == other.position)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public void draw(Matrix view) 
        {
            sphere.Draw(world, view, projection, color );
        }//end of draw

    }
}
